package com.order.feign.fallback;

import com.order.feign.client.GoodsService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * @className: GoodsServiceFallbackFactory
 * @Description: feign接口失败降级
 * @author: JiaZhenpeng
 * @data: 2022/11/1911:36
 */
@Slf4j
public class GoodsServiceFallbackFactory implements FallbackFactory<GoodsService> {
    @Override
    public GoodsService create(Throwable cause) {
        return new GoodsService() {
            @Override
            public String getGoods(Long id) {
                System.err.println("查询商品异常：" + cause);
                return "查询商品异常!!";
            }
        };
    }
}
